package routers

import (
	"5title_gin/internal/api/middleware"
	v1 "5title_gin/internal/api/v1"
	"5title_gin/internal/model"
	"5title_gin/internal/model/user"
	"github.com/gin-gonic/gin"
)

func UserRouter(g *gin.RouterGroup, a *gin.RouterGroup) {
	app := v1.App.UserApi
	a.POST("users/login", middleware.BindJsonMiddleware[user.LoginRequest], app.LoginView)
	g.GET("users/list", middleware.BindQueryMiddleware[model.PageInfo], app.UserListView)
	g.POST("users/logout", app.LogoutView)
	g.POST("users/refreshToken", app.RefreshToken)
	g.GET("users/info", app.GetUserInfo)
	g.PUT("users/update", middleware.BindQueryMiddleware[user.UserBo], app.UpdateUserInfo)
}
